import request from '@/utils/request'

// 查询用户列表
export function listUser(query) {
  return request({
    url: '/user/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细
export function getUserDetail(uid) {
  return request({
    url: '/user/info/by/' + uid,
    method: 'get',
  })
}


// 修改用户
export function updateUser(data) {
  return request({
    url: 'user/info/update',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data' // Important: set correct content type
    }
  })
}

// 删除用户
export function delUser(uid) {
  return request({
    url: 'user/info/delete/' + uid,
    method: 'delete'
  })
}

// 获取用户权限
export function resetPassword(uid,password) {
  return request({
    url: 'user/password/reset',
    method: 'post',
    data: {
      'uid': uid,
      'newPassword': password
    },
    headers: {
      'Content-Type': 'multipart/form-data' // Important: set correct content type
    }
  })
}

